import { game } from "cc";
import BTAction from "../../Base/BTAction";
import { NodeStatues } from "../../Enum";

//施法前摇
export default class ActionWait extends BTAction {
    private duration: number=2000;
    private startTime: number=0;

    constructor(duration: number=2000) {
        super();
        this.duration = duration;
    }

    onstart(): void {
        super.onstart();
        this.statues = game.totalTime;
        console.log("ActionWait onStart");
    }

    onUpdate(): NodeStatues {
        if(game.totalTime-this.startTime>this.duration){
            return NodeStatues.Success;
        }
        return NodeStatues.Running;
    }

    onEnd(): void {
        super.onEnd();
        console.log("ActionWait onEnd");
    
    }
}